﻿@model IEnumerable<QuanLyGiaoVuUI.Models.LopMonHoc.LopMonHocViewModel>
@{
    Layout = null;
}
<style>
    .table-holder {
        height: 400px;
    }
</style>
    <!-- end page-heading -->
    <div class="table-holder">
        <table class="data display datatable">
            <tr>
                <th class="sorting"></th>
                <th class="sorting">
                    @Html.DisplayNameFor(model => model.MaLopMonHoc)
                </th>
                <th class="sorting">Tên Môn học
                </th>
                <th class="sorting">
                    @Html.DisplayNameFor(model => model.MaGiangVien1)
                </th>
                <th class="sorting">Họ tên giảng viên 1
                </th>
                <th class="sorting">
                    @Html.DisplayNameFor(model => model.SiSoToiDa)
                </th>
                <th class="sorting">
                    @Html.DisplayNameFor(model => model.LopSinhVienId)
                </th>
            </tr>
            @{int count = 0;
            }
            @foreach (var item in Model)
            {
                <tr class="gradeA @(++count % 2 == 0 ? "even" : "odd")">
                    <td>
                        @Html.RadioButton("LopMonHocId", item.LopMonHocId)
                    </td>
                    <td class="maLopHolder">
                        @Html.DisplayFor(modelItem => item.MaLopDayDu)
                    </td>
                    <td class="tenMonHocHolder">
                        @Html.DisplayFor(modelItem => item.MonHoc.TenMonHoc)
                    </td>
                    <td>
                        @Html.DisplayFor(modelItem => item.GiangVien1.MaGiangVien)
                    </td>
                    <td>
                        @Html.DisplayFor(modelItem => item.GiangVien1.HoTenGV)
                    </td>

                    <td>
                        @Html.DisplayFor(modelItem => item.SiSoToiDa)
                    </td>
                    <td>
                        @Html.DisplayFor(modelItem => item.LopSinhVien.TenLop)
                    </td>
                </tr>
            }
        </table>
    </div>
<script>
    $(document).ready(function () {
        $("tr").each(function () {
            $(this).click(function () {
                var selectedRadio = $(this).find("input[type=radio]").first();
                var selectedLopMonHocId = selectedRadio.val();
                $(this).find("input[type=radio]").attr('checked', true);
                DanhSachLopMonHocObject.SelectedId = selectedLopMonHocId;
                DanhSachLopMonHocObject.MaLopMonHoc = selectedRadio.parent().parent().find(".maLopHolder").first().html();
                DanhSachLopMonHocObject.TenMonHoc = selectedRadio.parent().parent().find(".tenMonHocHolder").first().html();
            });
        });
    });

    var DanhSachLopMonHocObject = new function () {
        this.SelectedId = null;
        this.MaLopMonHoc = null;
        this.TenMonHoc = null;
        this.GetMaLopVaTenMonHoc = function () {
            try {
                return this.MaLopMonHoc + " - " + this.TenMonHoc;
            }
            catch (exception)
            { }
        }
    }
</script>
